const path = require('path')
    // const defaultSettings = require('./src/settings.js')

function resolve(dir) {
    return path.join(__dirname, dir)
}

module.exports = {

    chainWebpack(config) {

        // set svg-sprite-loader
        config.module
            .rule('svg')
            .exclude.add(resolve('src/icons'))
            .end()
        config.module
            .rule('icons')
            .test(/\.svg$/)
            .include.add(resolve('src/icons'))
            .end()
            .use('svg-sprite-loader')
            .loader('svg-sprite-loader')
            .options({
                symbolId: 'icon-[name]'
            })
            .end()

    },

    publicPath: process.env.NODE_ENV === 'production' ? './' : '/',
    outputDir: "hijklmn-admin",
    assetsDir: "assets",
    lintOnSave: false,
    runtimeCompiler: true,
    filenameHashing: false,
    lintOnSave: true,
    productionSourceMap: false,

    devServer: {

        overlay: {
            warning: true,
            errors: true
        },

        host: "0.0.0.0",
        port: 8081,
        https: false,
        open: false,
        hotOnly: true,

        proxy: {
            "/admin-server": {
                target: "http://localhost:8092",
                changeOrigin: true,
                ws: true,
                pathRewrite: {
                    "^/admin-server": ""
                }
            }
        }
    }
};